package com.think.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.annotation.Secured;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2018/5/21 0021.
 */
@RestController
public class HomeController {

    private static final Logger logger = LoggerFactory.getLogger(HomeController.class);

    @GetMapping("/")
    public String index(){
//        Msg msg =  new Msg("测试标题","测试内容","欢迎来到HOME页面,您拥有 ROLE_HOME 权限");
//        model.addAttribute("msg", msg);
        return "home";
    }

    @GetMapping("/login_failure")
    public String loginFailure() {
        return "login failure";
    }

    @Secured("ROLE_ADMIN")
    @GetMapping("/admin")
    public String hello(){
        return "hello admin";
    }


    @GetMapping("/root")
    public Map<String,Object> getRoot() {
        Map<String,Object> map = new HashMap<String,Object>();
        map.put("success",true);
        return map;
    }

}